<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\BlogBook
 *
 * @property int $id 图书主键
 * @property string $book_name 图书名
 * @property int|null $blog_user_uid 读者id
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook query()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook whereBlogUserUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook whereBookName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook whereId($value)
 * @mixin \Eloquent
 * @property int|null $uid 读者id
 * @property-read \App\Models\BlogUser|null $user
 * @method static \Illuminate\Database\Eloquent\Builder|BlogBook whereUid($value)
 */
class BlogBook extends Model
{
    //开放批量赋值
    protected $guarded = ['id'];

    //取消自动时间字段
    public $timestamps = false;


    use HasFactory;
    //一对多反向关联
    public function user()
    {
        return $this->belongsTo(BlogUser::class,'uid','id');
    }
}
